<!DOCTYPE html>












  


<html class="theme-next muse use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.1" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.1">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.1">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.1">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.1" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '6.4.1',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="Windows环境下Git安装、配置SSH key、安装node.js npm、安装Hexo及配置、发布博客">
<meta name="keywords" content="Git,Markdown,Hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="使用hexo+github搭建免费个人博客详细教程">
<meta property="og:url" content="http://theliang.coding.me/blog/2018/09/01/使用hexo-github搭建免费个人博客详细教程/index.html">
<meta property="og:site_name" content="Selier">
<meta property="og:description" content="Windows环境下Git安装、配置SSH key、安装node.js npm、安装Hexo及配置、发布博客">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190126340-14908623.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190141909-1450384498.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190153014-420712639.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190521939-2056097339.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190534226-238351279.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190546761-1464878819.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190556619-1255476458.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190608558-1708645956.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190619872-891453305.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190632881-375288848.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190644546-793260416.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190659051-1629328875.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190707783-1451686057.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190721843-1021546419.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190741306-151470933.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190750969-66693193.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190804675-494955249.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190848547-223170278.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190902147-1782153795.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190921261-1631802820.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190933177-694223567.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190944398-810517526.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190957690-629826974.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191012150-1786019153.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191019703-2020290697.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191031372-2140484801.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191040372-854255688.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191055508-803852270.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191116593-1369458680.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191129356-1418041949.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191144101-982627174.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191206940-654879261.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191218302-486031052.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191322591-724237821.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191350737-551083478.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193442441-433935082.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193454048-830663409.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193507623-2095208772.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193521996-1005543982.png">
<meta property="og:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193536120-2068336022.png">
<meta property="og:updated_time" content="2018-09-11T11:36:38.702Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用hexo+github搭建免费个人博客详细教程">
<meta name="twitter:description" content="Windows环境下Git安装、配置SSH key、安装node.js npm、安装Hexo及配置、发布博客">
<meta name="twitter:image" content="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190126340-14908623.png">



  <link rel="alternate" href="/atom.xml" title="Selier" type="application/atom+xml" />




  <link rel="canonical" href="http://theliang.coding.me/blog/2018/09/01/使用hexo-github搭建免费个人博客详细教程/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用hexo+github搭建免费个人博客详细教程 | Selier</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Selier</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">分享美的价值</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://theliang.coding.me/blog/2018/09/01/使用hexo-github搭建免费个人博客详细教程/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Selier">
      <meta itemprop="description" content="Java 技术 分享 博客 效率 工具 资源">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Selier">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用hexo+github搭建免费个人博客详细教程
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-09-01 08:35:08" itemprop="dateCreated datePublished" datetime="2018-09-01T08:35:08+08:00">2018-09-01</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-09-11 19:36:38" itemprop="dateModified" datetime="2018-09-11T19:36:38+08:00">2018-09-11</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Github/" itemprop="url" rel="index"><span itemprop="name">Github</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          
              <div class="post-description">Windows环境下Git安装、配置SSH key、安装node.js npm、安装Hexo及配置、发布博客</div>
          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <meta name="referrer" content="no-referrer">

<blockquote>
<p>Windows环境下Git安装、配置SSH key、安装node.js npm、安装Hexo及配置、发布博客</p>
</blockquote>
<a id="more"></a>
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>使用github pages服务搭建博客的好处有：</p>
<ol>
<li>全是静态文件，访问速度快；</li>
<li>免费方便，不用花一分钱就可以搭建一个自由的个人博客，不需要服务器不需要后台；</li>
<li>可以随意绑定自己的域名，不仔细看的话根本看不出来你的网站是基于github的；</li>
<li>数据绝对安全，基于github的版本管理，想恢复到哪个历史版本都行；</li>
<li>博客内容可以轻松打包、转移、发布到其它平台；<br>等等；</li>
</ol>
<h2 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h2><p>在开始一切之前，你必须已经：</p>
<ul>
<li>有一个github账号，没有的话去注册一个：<a href="https://github.com" target="_blank" rel="noopener">https://github.com</a></li>
<li>安装了git for windows（或者其它git客户端）：<a href="https://git-scm.com/downloads" target="_blank" rel="noopener">https://git-scm.com/downloads</a></li>
<li>安装了node.js、npm，并了解相关基础知识：<a href="https://nodejs.org/en/" target="_blank" rel="noopener">https://nodejs.org/en/</a></li>
</ul>
<blockquote>
<p>本文所使用的环境：</p>
</blockquote>
<p>Windows 10<br><a href="mailto:node.js@8.11.4" target="_blank" rel="noopener">node.js@8.11.4</a> x64<br><a href="mailto:git@2.18.0" target="_blank" rel="noopener">git@2.18.0</a> x64<br><a href="mailto:hexo@3.2.2" target="_blank" rel="noopener">hexo@3.2.2</a></p>
<h2 id="搭建github博客"><a href="#搭建github博客" class="headerlink" title="搭建github博客"></a>搭建github博客</h2><h3 id="创建仓库"><a href="#创建仓库" class="headerlink" title="创建仓库"></a>创建仓库</h3><p>新建一个名为 <code>你的用户名.github.io</code> 的仓库，比如说，如果你的github用户名是 <code>test</code> ，那么你就新建 <code>test.github.io</code> 的仓库（ <strong>必须是你的用户名</strong> ，其它名称无效），将来你的网站访问地址就是 <code>http://test.github.io</code> 了，是不是很方便？</p>
<p>由此可见，每一个github账户最多只能创建一个这样可以直接使用域名访问的仓库。</p>
<p>几个注意的地方：</p>
<ol>
<li>注册的邮箱一定要验证，否则不会成功；</li>
<li>仓库名字必须是：<code>username.github.io</code> ，其中username是你的用户名；</li>
<li>仓库创建成功不会立即生效，需要过一段时间，大概10-30分钟，或者更久;</li>
</ol>
<p>创建成功后，默认会在你这个仓库里生成一些示例页面，以后你的网站所有代码都是放在这个仓库里啦。</p>
<p><strong>具体步骤截图如下：</strong></p>
<h4 id="新建仓库"><a href="#新建仓库" class="headerlink" title="新建仓库"></a>新建仓库</h4><p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190126340-14908623.png" alt=""></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190141909-1450384498.png" alt=""></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190153014-420712639.png" alt=""></p>
<p>创建完成</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190521939-2056097339.png" alt=""></p>
<p>过了一会后就可以访问自己的网站啦！</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190534226-238351279.png" alt=""></p>
<h3 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h3><h4 id="下载安装"><a href="#下载安装" class="headerlink" title="下载安装"></a>下载安装</h4><p>打开Git <a href="https://git-scm.com/downloads" target="_blank" rel="noopener">下载地址</a> ，我们点 windows</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190546761-1464878819.png" alt=""></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190556619-1255476458.png" alt=""></p>
<blockquote>
<p>这里我推荐使用便携版，因为很多人不喜欢安装软件，何况又是一个不太经常使用的软件，所以便携版安装卸载都很方便<br>如果下载的是安装版，那么你直接按默认值一直点下一步就可以了。如果实在不会安装可以去网上找教程。</p>
</blockquote>
<p>便携版下载完只需要解压，再配置环境变量</p>
<p>下载完后解压的文件如下：</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190608558-1708645956.png" alt=""></p>
<p>打开系统的环境变量，编辑Path环境变，新建路径： <code>git的存放目录</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190619872-891453305.png" alt=""></p>
<p>至此，git算是安装完成啦，我们可以打开控制台测试一下</p>
<p> <code>win</code> + <code>r</code> 输入 <code>cmd</code>  ，然后 输入 <code>git --version</code> </p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190632881-375288848.png" alt=""></p>
<h4 id="配置SSH-key"><a href="#配置SSH-key" class="headerlink" title="配置SSH key"></a>配置SSH key</h4><blockquote>
<p>为什么要配置这个呢？因为你提交代码肯定要拥有你的github权限才可以，但是直接使用用户名和密码太不安全了，所以我们使用ssh key来解决本地和服务器的连接问题。</p>
</blockquote>
<p>1、运行命令： <code>ssh-keygen -t rsa -C &quot;邮件地址&quot;</code> 。邮件地址可以登录你的github - <code>Setting</code> - <code>Emails</code> 查看</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190644546-793260416.png" alt=""></p>
<p>2、然后连续3次回车，最终会生成一个文件在用户目录下</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190659051-1629328875.png" alt=""></p>
<p>3、打开用户目录，找到 <code>.ssh\id_rsa.pub</code> 文件，记事本打开并复制里面的内容</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190707783-1451686057.png" alt=""></p>
<p>4、打开你的github主页，进入 <code>个人设置</code> - <code>SSH and GPG keys</code> - <code>New SSH key</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190721843-1021546419.png" alt=""></p>
<p>将刚复制的内容粘贴到key那里，title随便填，保存。</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190741306-151470933.png" alt=""></p>
<p>5、测试连接</p>
<p>运行命令： <code>ssh -T git@github.com</code> 。<strong>注意这条命令不用修改，直接运行</strong></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190750969-66693193.png" alt=""></p>
<p>6、全局配置</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name &quot;selier&quot;    // 你的github用户名，非昵称</span><br><span class="line">git config --global user.email  &quot;邮箱@qq.com&quot;    // 填写你的github注册邮箱</span><br></pre></td></tr></table></figure>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190804675-494955249.png" alt=""></p>
<blockquote>
<p>至此，你的Git就配置好了</p>
</blockquote>
<h3 id="安装-node-js"><a href="#安装-node-js" class="headerlink" title="安装 node.js"></a>安装 node.js</h3><p>下载安装 <a href="https://nodejs.org/en/" target="_blank" rel="noopener">nodeJs</a> ，随便选一个即可，下载后安装时一路默认next (安装路径可以自选)。</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190848547-223170278.png" alt=""></p>
<p>安装完成后，测试是否安装成功</p>
<p>在 控制台中 输入 <code>node -v</code> ，<code>npm -v</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190902147-1782153795.png" alt=""></p>
<p>此处说明下：新版的Node.js已自带npm，安装Node.js时会一起安装，npm的作用就是对Node.js依赖的包进行管理，也可以理解为用来安装/卸载Node.js需要装的东西</p>
<h3 id="使用hexo写博客"><a href="#使用hexo写博客" class="headerlink" title="使用hexo写博客"></a>使用hexo写博客</h3><h4 id="1、简介"><a href="#1、简介" class="headerlink" title="1、简介"></a>1、简介</h4><p><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">Hexo</a> 是一个简单、快速、强大的基于 Github Pages 的博客发布工具，支持Markdown格式，有众多优秀插件和主题。</p>
<h4 id="2、原理"><a href="#2、原理" class="headerlink" title="2、原理"></a>2、原理</h4><p>由于github pages存放的都是静态文件，博客存放的不只是文章内容，还有文章列表、分类、标签、翻页等动态内容，假如每次写完一篇文章都要手动更新博文目录和相关链接信息，相信谁都会疯掉，所以hexo所做的就是将这些md文件都放在本地，每次写完文章后调用写好的命令来批量完成相关页面的生成，然后再将有改动的页面提交到github。</p>
<h4 id="3、注意事项"><a href="#3、注意事项" class="headerlink" title="3、注意事项"></a>3、注意事项</h4><p>安装之前先来说几个注意事项：</p>
<ol>
<li>很多命令既可以用Windows的 <code>cmd</code> 来完成，也可以使用 <code>git bash</code> / <code>git cmd</code>来完成，但是这里因为我用的是便携版 git ，所以我用的是git目录下的 <code>git-cmd</code></li>
<li>git安装版会集成鼠标右键菜单 <code>git-bash</code> ，所以下面很多步骤中需要通过git跳转到某个目录的，你可以直接打开这个目录，在空白处右键 - <code>git-bash</code></li>
<li>hexo不同版本差别比较大，网上很多文章的配置信息都是基于2.x的，所以注意不要被误导；</li>
<li>hexo有2种 <code>_config.yml</code> 文件，一个是根目录下的全局的 <code>_config.yml</code> ，一个是各个 <code>theme</code> 下的；</li>
</ol>
<h4 id="4、安装"><a href="#4、安装" class="headerlink" title="4、安装"></a>4、安装</h4><p>1、打开 <code>git-cmd</code> ，输入 <code>npm install hexo-cli  -g</code> 进行安装。如果显示报错“ <strong>没有这个指令</strong> ”，请点击 <a href="https://www.jianshu.com/p/03a76b2e7e00" target="_blank" rel="noopener">这个网站</a> 看第五点，配置nodeJs全局环境。</p>
<blockquote>
<p>可能你的网络无法访问网站并安装，那么你可以通过 <a href="http://npm.taobao.org/" target="_blank" rel="noopener">淘宝NPM镜像</a> 来安装： <code>npm install -g cnpm --registry=https://registry.npm.taobao.org</code> ，之后下面的所有用到 <code>npm</code> 的命令，可以使用 <code>cnpm</code> 代替 ，如 <code>npm install hexo-cli  -g</code> 改成 <code>cnpm install hexo-cli  -g</code></p>
</blockquote>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190921261-1631802820.png" alt=""></p>
<p>2、 再输入 <code>npm install hexo --save</code> ，等待安装完成。</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190933177-694223567.png" alt=""></p>
<p>3、初始化</p>
<p>3.1、在电脑的某个地方新建一个文件夹（名字可以随便取），比如我的是 <code>D:\我的文档\selierlin.github.io</code> ，由于这个文件夹将来就作为你存放代码的地方，所以最好不要随便放。</p>
<p>3.2、打开 <code>git-cmd</code> ，跳转到刚刚创建的文件夹位置，运行命令 <code>hexo init</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190944398-810517526.png" alt=""></p>
<p>然后会在你的文件夹中搭建好了环境</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911190957690-629826974.png" alt=""></p>
<h4 id="5、配置-config-yml"><a href="#5、配置-config-yml" class="headerlink" title="5、配置 __config.yml"></a>5、配置 <code>__config.yml</code></h4><p>1、修改一些你的博客名字、描述、作者等。同时大家可以修改自己的主题，更多主题 <a href="https://hexo.io/themes/" target="_blank" rel="noopener">点击这里</a> 。修改主题就修改 <code>_config.yml</code> 里面的 <code>theme</code> 。<a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="noopener">更多关于其他配置信息修改请点击这里访问hexo官方文档</a> 。</p>
<blockquote>
<p>在 <code>_config.yml</code> 文档修改所有信息都要注意， <strong>冒号后面一定要有一个空格</strong></p>
</blockquote>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191012150-1786019153.png" alt=""></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191019703-2020290697.png" alt=""></p>
<p>2、hexo与github关联配置</p>
<ul>
<li>type改成git</li>
<li>repo的格式就是：<a href="mailto:`git@github.com" target="_blank" rel="noopener">`git@github.com</a>:你的用户名/你的用户名.github.io.git`</li>
<li>branch为master</li>
</ul>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191031372-2140484801.png" alt=""></p>
<h4 id="6、启动本地服务"><a href="#6、启动本地服务" class="headerlink" title="6、启动本地服务"></a>6、启动本地服务</h4><p>1、使用 <code>git-cmd</code> 跳转到你的博客目录，依次输入以下命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo g  # 生成</span><br><span class="line">hexo s  # 启动服务</span><br></pre></td></tr></table></figure>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191040372-854255688.png" alt=""></p>
<p>2、然后可以通过浏览器访问：<a href="http://127.0.0.1:4000" target="_blank" rel="noopener">http://127.0.0.1:4000</a> 你就看到你的博客样子啦。停止你的本地服务器，你可以在Git命令页面按住 <code>Ctrl+C</code> 来停止。</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191055508-803852270.png" alt=""></p>
<blockquote>
<p>如果浏览器一直转圈圈，加载不出来，一般情况下是因为端口占用的缘故，<a href="https://www.cnblogs.com/selier/p/9514426.html" target="_blank" rel="noopener">解决方法</a></p>
</blockquote>
<h4 id="7、上传到Github"><a href="#7、上传到Github" class="headerlink" title="7、上传到Github"></a>7、上传到Github</h4><blockquote>
<p>在上传代码到github之前，一定要记得先把你以前所有代码下载下来（虽然github有版本管理，但备份一下总是好的），因为从hexo提交代码时会把你以前的所有代码都删掉。</p>
</blockquote>
<p>1、确认你的 <code>_config.yml</code> 文件已经配置了Deployment</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191116593-1369458680.png" alt=""></p>
<p>2、<code>git-cmd</code> 跳转到博客目录，安装Hexo部署的插件 ： <code>npm install hexo-deployer-git --save</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191129356-1418041949.png" alt=""></p>
<p>3、使用 <code>git-bash</code> 跳转到博客目录 ，运行命令 <code>hexo d</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191144101-982627174.png" alt=""></p>
<p>同时，在你的github上已经上传了文件</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191206940-654879261.png" alt=""></p>
<blockquote>
<p>如果出现 <code>Deployer not found: git</code> 说明Hexo部署的插件没有安装好</p>
</blockquote>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191218302-486031052.png" alt=""></p>
<p>4、发布完成，现在可以通过 <code>你的用户名.github.io</code> 访问自己的网站啦</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191322591-724237821.png" alt=""></p>
<h3 id="其它"><a href="#其它" class="headerlink" title="其它"></a>其它</h3><h4 id="1、保留CNAME、README-md等文件"><a href="#1、保留CNAME、README-md等文件" class="headerlink" title="1、保留CNAME、README.md等文件"></a>1、保留CNAME、README.md等文件</h4><p>提交之后网页上一看，发现以前其它代码都没了，此时不要慌，一些非md文件可以把他们放到source文件夹下，这里的所有文件都会原样复制（除了md文件）到public目录的</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911191350737-551083478.png" alt=""></p>
<blockquote>
<p>由于hexo默认会把所有md文件都转换成html，包括README.md，所有需要每次生成之后、上传之前，手动将README.md复制到public目录，并删除README.html。</p>
</blockquote>
<h4 id="2、常用hexo命令"><a href="#2、常用hexo命令" class="headerlink" title="2、常用hexo命令"></a>2、常用hexo命令</h4><p>常见命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">hexo new &quot;postName&quot; #新建文章</span><br><span class="line">hexo new page &quot;pageName&quot; #新建页面</span><br><span class="line">hexo generate #生成静态页面至public目录</span><br><span class="line">hexo server #开启预览访问端口（默认端口4000，&apos;ctrl + c&apos;关闭server）</span><br><span class="line">hexo deploy #部署到GitHub</span><br><span class="line">hexo help  # 查看帮助</span><br><span class="line">hexo version  #查看Hexo的版本</span><br></pre></td></tr></table></figure>
<p>缩写：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">hexo n == hexo new</span><br><span class="line">hexo g == hexo generate</span><br><span class="line">hexo s == hexo server</span><br><span class="line">hexo d == hexo deploy</span><br></pre></td></tr></table></figure>
<p>组合命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo s -g #生成并本地预览</span><br><span class="line">hexo d -g #生成并上传</span><br></pre></td></tr></table></figure>
<h4 id="3、-config-yml"><a href="#3、-config-yml" class="headerlink" title="3、_config.yml"></a>3、_config.yml</h4><p>这里面都是一些全局配置，每个参数的意思都比较简单明了，所以就不作详细介绍了。<a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="noopener">更多关于其他配置信息修改请点击这里访问hexo官方文档</a> </p>
<p>需要特别注意的地方是，冒号后面必须有 <strong>一个空格</strong> ，否则可能会出问题。</p>
<h4 id="4、写博客"><a href="#4、写博客" class="headerlink" title="4、写博客"></a>4、写博客</h4><p>写博客并上传的过程如下：</p>
<ul>
<li>在hexo根目录使用 <code>hexo new &#39;标题&#39;</code> 创建文章</li>
<li>编写文章后，使用 <code>hexo g</code> 生成静态文件到public</li>
<li>使用 <code>hexo d</code> 发布到github</li>
</ul>
<blockquote>
<p>也可以使用组合命令 <code>hexo d -g</code> 生成并上传</p>
</blockquote>
<hr>
<p>定位到我们的hexo根目录，执行命令： <code>hexo new &#39;my-first-blog&#39;</code></p>
<p>hexo会帮我们在_posts下生成相关md文件</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193442441-433935082.png" alt=""></p>
<p>我们只需要打开这个文件就可以开始写博客了，默认生成如下内容</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193454048-830663409.png" alt=""></p>
<p>当然你也可以直接自己新建md文件，用这个命令的好处是帮我们自动生成了时间。</p>
<p>一般完整格式如下：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: postName #文章页面上的显示名称，一般是中文</span><br><span class="line">date: 2013-12-02 15:30:16 #文章生成时间，一般不改，当然也可以任意修改</span><br><span class="line">categories: 默认分类 #分类</span><br><span class="line">tags: [tag1,tag2,tag3] #文章标签，可空，多标签请用格式，注意:后面有个空格</span><br><span class="line">description: 附加一段文章摘要，字数最好在140字以内，会出现在meta的description里面</span><br><span class="line">---</span><br><span class="line"></span><br><span class="line">以下是正文</span><br></pre></td></tr></table></figure>
<p>那么 <code>hexo new page &#39;postName&#39;</code> 命令和 <code>hexo new &#39;postName&#39;</code> 有什么区别呢？</p>
<p><code>hexo new page &quot;my-second-blog&quot;</code> 生成如下：</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193507623-2095208772.png" alt=""></p>
<p>最终部署时生成：<code>博客目录\public\my-second-blog\index.html</code> ，但是它不会作为文章出现在博文目录。</p>
<h4 id="5、修改主题"><a href="#5、修改主题" class="headerlink" title="5、修改主题"></a>5、修改主题</h4><p>既然默认主题很丑，那我们首先来替换一个好看点的主题。这是 <a href="https://hexo.io/themes/" target="_blank" rel="noopener">官方主题</a></p>
<p>这里我推荐几款不错的主题：</p>
<table>
<thead>
<tr>
<th style="text-align:left">仓库地址</th>
<th style="text-align:left">演示地址</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><a href="https://github.com/iissnan/hexo-theme-next" target="_blank" rel="noopener">NexT</a></td>
<td style="text-align:left"><a href="https://notes.iissnan.com/" target="_blank" rel="noopener">https://notes.iissnan.com/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/theme-next/hexo-theme-next" target="_blank" rel="noopener">NexT6.0</a></td>
<td style="text-align:left"><a href="https://theme-next.org/" target="_blank" rel="noopener">https://theme-next.org/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/litten/hexo-theme-yilia" target="_blank" rel="noopener">yilia</a></td>
<td style="text-align:left"><a href="http://litten.me/" target="_blank" rel="noopener">http://litten.me/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/MOxFIVE/hexo-theme-yelee" target="_blank" rel="noopener">yelee</a></td>
<td style="text-align:left"><a href="http://moxfive.xyz/" target="_blank" rel="noopener">http://moxfive.xyz/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/viosey/hexo-theme-material" target="_blank" rel="noopener">material</a></td>
<td style="text-align:left"><a href="https://blog.nfz.moe/" target="_blank" rel="noopener">https://blog.nfz.moe/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank" rel="noopener">indigo</a></td>
<td style="text-align:left"><a href="https://imys.net/" target="_blank" rel="noopener">https://imys.net/</a></td>
</tr>
<tr>
<td style="text-align:left"><a href="https://github.com/tufu9441/maupassant-hexo" target="_blank" rel="noopener">maupassant</a></td>
<td style="text-align:left"><a href="https://www.haomwei.com" target="_blank" rel="noopener">https://www.haomwei.com</a></td>
</tr>
</tbody>
</table>
<p>安装步骤：</p>
<ul>
<li>打开 <code>git-cmd</code> ，跳转到你的博客目录</li>
<li>使用 git 拉取主题 <code>git clone 仓库主题地址.git themes/主题名称</code> ，意思是下载主题并将其保存到themes目录下</li>
</ul>
<p>如：<code>git clone https://github.com/iissnan/hexo-theme-next.git themes/next</code></p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193521996-1005543982.png" alt=""></p>
<ul>
<li>修改 主目录下 <code>_config.yml</code> 中的 <code>theme: landscape</code> 改为 <code>theme: next</code> ，然后重新执行 <code>hexo g</code> 来重新生成。</li>
</ul>
<blockquote>
<p>如果出现一些莫名其妙的问题，可以先执行 <code>hexo clean</code> 来清理一下public的内容，然后再来重新生成和发布 <code>hexo d -g</code></p>
</blockquote>
<ul>
<li>安装完主题后，建议开启标签页、分类页</li>
</ul>
<blockquote>
<p>由于某些主题需要用到标签、分类，但是它的安装方法中又没有描述清楚。基于我的个人经验，建议都开启</p>
</blockquote>
<p>1、开启标签页命令 ：<code>hexo new page tags</code>  ，在 <code>博客目录/source/tags/index.md</code> 添加元数据：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">layout: tags</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure>
<p>2、开启分类页命令 ：<code>hexo new page categories</code>  ，在 <code>博客目录/source/categories/index.md</code> 添加元数据：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">layout: categories</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure>
<h4 id="6、如何让博文列表不显示全部内容"><a href="#6、如何让博文列表不显示全部内容" class="headerlink" title="6、如何让博文列表不显示全部内容"></a>6、如何让博文列表不显示全部内容</h4><p>默认情况下，生成的博文目录会显示全部的文章内容，如何设置文章摘要的长度呢？</p>
<p>答案是在合适的位置加上 <code>&lt;!--more--&gt;</code> 即可，例如：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="section"># 前言</span></span><br><span class="line"></span><br><span class="line">使用github pages服务搭建博客的好处有：</span><br><span class="line"></span><br><span class="line"><span class="bullet">1. </span>全是静态文件，访问速度快；</span><br><span class="line"><span class="bullet">2. </span>免费方便，不用花一分钱就可以搭建一个自由的个人博客，不需要服务器不需要后台；</span><br><span class="line"><span class="bullet">3. </span>可以随意绑定自己的域名，不仔细看的话根本看不出来你的网站是基于github的；</span><br><span class="line"></span><br><span class="line">&lt;!--more--&gt;</span><br><span class="line"></span><br><span class="line"><span class="bullet">4. </span>数据绝对安全，基于github的版本管理，想恢复到哪个历史版本都行；</span><br><span class="line"><span class="bullet">5. </span>博客内容可以轻松打包、转移、发布到其它平台；</span><br><span class="line"><span class="bullet">6. </span>等等；</span><br></pre></td></tr></table></figure>
<p>最终效果：</p>
<p><img src="https://images2018.cnblogs.com/blog/1469487/201809/1469487-20180911193536120-2068336022.png" alt=""></p>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Git/" rel="tag"># Git</a>
          
            <a href="/tags/Markdown/" rel="tag"># Markdown</a>
          
            <a href="/tags/Hexo/" rel="tag"># Hexo</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/09/01/微擎安装使用及插件模块安装/" rel="prev" title="微擎安装使用及插件模块安装">
                微擎安装使用及插件模块安装 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Selier</p>
              <p class="site-description motion-element" itemprop="description">Java 技术 分享 博客 效率 工具 资源</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">7</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">5</span>
                    <span class="site-state-item-name">分类</span>
                  
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">11</span>
                    <span class="site-state-item-name">标签</span>
                  
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#准备工作"><span class="nav-number">1.1.</span> <span class="nav-text">准备工作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#搭建github博客"><span class="nav-number">1.2.</span> <span class="nav-text">搭建github博客</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#创建仓库"><span class="nav-number">1.2.1.</span> <span class="nav-text">创建仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#新建仓库"><span class="nav-number">1.2.1.1.</span> <span class="nav-text">新建仓库</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装Git"><span class="nav-number">1.2.2.</span> <span class="nav-text">安装Git</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#下载安装"><span class="nav-number">1.2.2.1.</span> <span class="nav-text">下载安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置SSH-key"><span class="nav-number">1.2.2.2.</span> <span class="nav-text">配置SSH key</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装-node-js"><span class="nav-number">1.2.3.</span> <span class="nav-text">安装 node.js</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用hexo写博客"><span class="nav-number">1.2.4.</span> <span class="nav-text">使用hexo写博客</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、简介"><span class="nav-number">1.2.4.1.</span> <span class="nav-text">1、简介</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、原理"><span class="nav-number">1.2.4.2.</span> <span class="nav-text">2、原理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3、注意事项"><span class="nav-number">1.2.4.3.</span> <span class="nav-text">3、注意事项</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4、安装"><span class="nav-number">1.2.4.4.</span> <span class="nav-text">4、安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#5、配置-config-yml"><span class="nav-number">1.2.4.5.</span> <span class="nav-text">5、配置 __config.yml</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6、启动本地服务"><span class="nav-number">1.2.4.6.</span> <span class="nav-text">6、启动本地服务</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#7、上传到Github"><span class="nav-number">1.2.4.7.</span> <span class="nav-text">7、上传到Github</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#其它"><span class="nav-number">1.2.5.</span> <span class="nav-text">其它</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、保留CNAME、README-md等文件"><span class="nav-number">1.2.5.1.</span> <span class="nav-text">1、保留CNAME、README.md等文件</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、常用hexo命令"><span class="nav-number">1.2.5.2.</span> <span class="nav-text">2、常用hexo命令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3、-config-yml"><span class="nav-number">1.2.5.3.</span> <span class="nav-text">3、_config.yml</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4、写博客"><span class="nav-number">1.2.5.4.</span> <span class="nav-text">4、写博客</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#5、修改主题"><span class="nav-number">1.2.5.5.</span> <span class="nav-text">5、修改主题</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6、如何让博文列表不显示全部内容"><span class="nav-number">1.2.5.6.</span> <span class="nav-text">6、如何让博文列表不显示全部内容</span></a></li></ol></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Selier</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Muse</a> v6.4.1</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.1"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
